﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ChemicalEquilibrium
{
    public class Reactants
    {
        public Queue<Reactant> Active = new Queue<Reactant>(10000);

        public Queue<Reactant> Inactive = new Queue<Reactant>(10000);

        public int GetActiveCount() { return this.Active.Count; }

        public int GetInactiveCount() { return this.Inactive.Count; }

        public Reactants()
        {
        }

        public Reactants(int activeCount, int inactiveCount)
        {
            for (int i = 0; i < activeCount; i++)
            {
                this.Active.Enqueue(new Reactant());
            }

            for (int i = 0; i < inactiveCount; i++)
            {
                this.Inactive.Enqueue(new Reactant());
            }
        }

        public void Activate(int count)
        {
            for (int i = 0; i < count; i++)
            {
                if (this.Inactive.Count == 0) break;

                this.Active.Enqueue(this.Inactive.Dequeue());
            }
        }

        public void Inactivate(int count)
        {
            for (int i = 0; i < count; i++)
            {
                if (this.Active.Count == 0) break;

                this.Inactive.Enqueue(this.Active.Dequeue());
            }
        }
    }
}
